const Router = require('koa-router')
const authRouter = new Router({ prefix: '/moment' })
const {
  create,
  detail,
  list,
  update,
  remove
} = require('../controller/moment.controller')

const {
  verifyAuth,
  verifyPermission
} = require('../middleware/auth.middleware')
// 
// 发布动态
authRouter.post('/', verifyAuth, create)
// 获取某一条 动态  ，不需要验证用户是否登录
authRouter.get('/:momentId', detail)
// 获取 所有的 动态
authRouter.get('/', list)
// 修改 动态， 1. 验证是否登录  2. 是否具备修改动态的权限
authRouter.patch('/:momentId', verifyAuth, verifyPermission, update)
// 删除
authRouter.delete('/:momentId', verifyAuth, verifyPermission, remove)

module.exports = authRouter